﻿$(function () {

    // Form validation
    $('#form-agenda').validate({
        rules: {
            "ddlUsuario": {
                required: true
            },
            "ddlProcedimento": {
                required: true
            },
            "consultaDescricao": {
                required: true
            },
            "DataHora": {
                required: true
            }
        },
        highlight: function (element) {
            $(element).closest('.form-group').removeClass('success').addClass('error');
        },
        success: function (element) {
            element.addClass('valid').closest('.form-group').removeClass('error').addClass('success');
        }
    });

    ////// Product tags with select2
    //$("#product-tags").select2({
    //    placeholder: 'Select tags or add new ones',
    //    tags: ["shirt", "gloves", "socks", "sweater"],
    //    tokenSeparators: [",", " "]
    //});

    // Bootstrap wysiwyg
    //$("#summernote").summernote({
    //    height: 240,
    //    toolbar: [
    //        ['style', ['style']],
    //        ['style', ['bold', 'italic', 'underline', 'clear']],
    //        ['fontsize', ['fontsize']],
    //        ['para', ['ul', 'ol', 'paragraph']],
    //        ['height', ['height']],
    //        ['insert', ['picture', 'link', 'video']],
    //        ['view', ['fullscreen', 'codeview']],
    //        ['table', ['table']],
    //    ]
    //});

    //// jQuery rating
    //$('#raty').raty({
    //    path: 'images/raty',
    //    score: 4
    //});



    //// Minicolors colorpicker
    //$('input.minicolors').minicolors({
    //    position: 'top left',
    //    defaultValue: '#9b86d1',
    //    theme: 'bootstrap'
    //});

    // masked input example using phone input
    $(".mask-phone").mask("(999) 999-9999");
    $(".mask-cc").mask("9999 9999 9999 9999");


    $("#hora").mask("99:99:99");





   

});

var contMed = 0;

function salvarMedicamento() {

    contMed++;
    var strHtml = "<tr id=\"" + contMed + "\"><td><input type=\"hidden\" name=\"medicamento\" value=\"" + $("#medicamentoDescricao").val() + "\" />" + $("#medicamentoDescricao").val() + "</td><td><a href=\"javascript:excluirMedicamento(" + contMed + ");\">Excluir</a></td></tr>";

    $("#tbMedicamentos").append(strHtml);

    $("#medicamentoDescricao").val("");
}


function excluirMedicamento(id)
{
    $("#" + id).remove();    
}


